import random
import os
# with open('numbers.txt', 'w') as f:
#     for i in range(0, 100):
#         num = random.randint(1, 100)
#         f.write(str(num))
#     f.flush()

# with open('numbers.txt', 'w') as f:
#     for i in range(0, 100):
#         num = random.randint(1, 100)
#         f.write(f'{num}\n')

with open('numbers.txt', 'a') as f:
    for i in range(0, 100):
        num = random.randint(1, 100)
        f.write(f'{num}\n')

with open('numbers.txt', 'w') as f:
    nums = []
    for i in range(0, 100):
        num = random.randint(1, 100)
        nums.append(f'{num}\n')
    f.writelines(nums)
    print(os.path.abspath('numbers.txt'))

